#include "SimpleCanvasRoot.h"
#include "SimpleCanvasProtect.cpp"
#include "util/UUID.h"
using namespace yzrilyzr_util;
namespace yzrilyzr_simplecanvas{
	void SimpleCanvasRoot::draw(SkCanvas & canvas){
		canvas.clear(backgroundColor);
		if(baseView != nullptr)baseView->draw(canvas);
		UUID uuid={0x1234567812345678, 0x8765432187654321};
		embedBlindWatermark(canvas, uuid);
	}
	void SimpleCanvasRoot::event(const UIEvent * event){
		if(baseView != nullptr)baseView->dispatchEvent(event);
	}
	void SimpleCanvasRoot::changeSize(const uint32_t width, const uint32_t height){
		if(baseView != nullptr){
			MeasureSpec wSpec{MeasureSpec::EXACTLY, width};
			MeasureSpec hSpec{MeasureSpec::EXACTLY, height};
			baseView->measure(wSpec, hSpec);
			Rect rect{0, 0, width, height};
			baseView->layout(rect);
		}
	}
	
	

}